<?php
/**
 * This script lists all terms and their frequency for a given
 * xapian index.
 *
 * @author Rob Young
 */
require_once dirname(__FILE__) . '/../../lib/Forage.php';

$forage = Forage::create($_SERVER['argv'][1]);
$xapian = $forage->engine->getReadonlyDatabase();

$iterator = $xapian->allterms_begin();
while (!$iterator->equals($xapian->allterms_end())) {
  echo $iterator->get_term() . " (" . $iterator->get_termfreq() . ")\n";
  $iterator->next();
}


